/*
 * Project: Daycare Web Application
 * Package: com.made2ordersoftware.daycare.domain
 * File:    FeesEntity.java
 * Created: Dec 20, 2010
 */
/**
 * Copyright (c) 2010 Made 2 Order Software, LLC
 *
 * All rights reserved. No part of this software may be reproduced, stored in a retrieval system, or
 * transmitted in any form or by any means, without the prior written permission of Made 2 Order Software.
 *
 * You may not distribute the URL or redistribute the files to third parties. You may transfer the files onto
 * a single storage device so long as you can prove ownership of the software. You may not reverse engineer,
 * decompile, or disassemble the software or media files. You may not modify or translate the software or
 * media, or distribute copies of the software or media without the written consent of Made 2 Order Software,
 * LLC.
 */
package com.made2ordersoftware.daycare.domain;

import com.made2ordersoftware.util.StringUtility;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Entity class representing the amounts associated with children registered with the day care.
 *
 * @author David Canning <dcannin@gmail.com>
 * @version 1.0.0
 */
@Entity
@Table(name = "fee")
@NamedQueries({
    @NamedQuery(name = "Fees.findByAgeAndWatchCode", query = "SELECT f FROM FeesEntity f WHERE f.age = :age and f.watchCode = :watchCode")})
@XmlRootElement
public class FeesEntity implements Serializable {

    private static final Logger LOG = LoggerFactory.getLogger(FeesEntity.class);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "age")
    private int age;
    @Basic(optional = false)
    @Column(name = "watch_code")
    private String watchCode;
    @Basic(optional = false)
    @Column(name = "fee")
    private float amount;

    /**
     * Creates an instance of <code>FeesEntity</code>.
     */
    public FeesEntity() {
    }

    /**
     * Creates an instance of <code>FeesEntity</code>.
     *
     * @param age       Age of child
     * @param watchCode Watch code for this stay
     * @param amount    Amount to charge for this stay
     */
    public FeesEntity(int age, String watchCode, float amount) {
        this.age = age;
        this.watchCode = watchCode;
        this.amount = amount;
    }

    /**
     * Returns the id of the FeesEntity.
     *
     * @return ID of amount
     */
    public Integer getId() {
        return id;
    }

    /**
     * Sets the id of the FeesEntity.
     *
     * @param id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * Returns the age of the FeesEntity.
     *
     * @return the age for this amount
     */
    public int getAge() {
        return age;
    }

    /**
     * Sets the age of the FeesEntity.
     *
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * Returns the watch code of the FeesEntity.
     *
     * @return the watchCode for this amount
     */
    public String getWatchCode() {
        return watchCode;
    }

    /**
     * Sets the watch code of the FeesEntity.
     *
     * @param watchCode
     */
    public void setWatchCode(String watchCode) {
        this.watchCode = watchCode;
    }

    /**
     * Returns the amount of the FeesEntity.
     *
     * @return the amount
     */
    public float getAmount() {
        return amount;
    }

    /**
     * Sets the amount of the FeesEntity.
     *
     * @param amount
     */
    public void setAmount(float amount) {
        this.amount = amount;
    }

    @Override
    public int hashCode() {
        int hash = 1;
        hash = 48 * hash + Objects.hashCode(this.id);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof FeesEntity)) {
            return false;
        }
        FeesEntity other = (FeesEntity) object;
        return Objects.equals(this.id, other.getId());
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("\nFeeEntity{ id=").append(
                StringUtility.ifNotNullToString(getId()));
        sb.append("\n\tAge=").append(this.age);
        sb.append("\n\tWatch Code=").append(this.watchCode);
        sb.append("\n\tFee=").append(this.amount);
        sb.append("}");
        return sb.toString();
    }
}
